<?php


namespace App\Biquge;


use App\Job\IJob;
use App\Utils\Logger;

class FileJob extends IJob
{
    protected $character;
    protected $book_id;

    public function __construct($character, $book_id)
    {
        $this->character = $character;
        $this->book_id = $book_id;
    }

    public function handle()
    {
        try {
            (new Character())->crawl($this->character, $this->book_id);
        }catch (\Exception $e) {
            Logger::getLogger('file')->error('error', [$e]);
            dispatch($this)->onQueue('noval');
        }
    }
}